﻿<%@ Page Language="C#" MasterPageFile="~/Views/Shared/Site.Master" Inherits="System.Web.Mvc.ViewPage" %>
<%@ Import Namespace="Microsoft.Web.Mvc"%>
<asp:Content ID="indexHead" ContentPlaceHolderID="head" runat="server">
    <title>Quản lý đơn hàng</title>
</asp:Content>
<asp:Content ID="css_js" ContentPlaceHolderID="js_css" runat="server">
    <script type="text/javascript" src="/scripts/historyorder.js"></script>
</asp:Content>
<asp:Content ID="indexContentLeft" ContentPlaceHolderID="left_content" runat="server">
     <div class="title"><span class="title_icon"><img src="/content/images/bullet1.gif" alt="" title="" /></span>Quản lý đơn hàng</div>
        
        	<div class="feat_prod_box_details">
            
            <table class="cart_table">
            	<%  int i = 0; string[][] result = (string[][])ViewData["result"];
                 if (result != null && result[0] != null)
    {%>
            	<tr class="cart_title">
					
                	<td>Ngày Tạo</td>
                	<td>Số Loại Sách</td>
					<td>Thanh Toán</td>
                    <td>Giao Hàng</td>
                    <td>Giá Giao Hàng</td>
					<td>Tổng Tiền</td>
					<td>Loại</td>
					<td>Trạng Thái</td>
					<td>Chi Tiết</td>					
                </tr>
 <% int total = 0;
        foreach (string[] row in result)
        { 
            if (row == null) break; i++; total += Convert.ToInt32(row[6]);%>                
            	<tr id="tr_<%=Html.Encode(i) %>">
					
                	<td><%= Html.Encode(row[1]) %></td>
                	<td><%= Html.Encode(row[2]) %></td>
                    <td><%= Html.Encode(row[3]) %></td>
					<td><%= Html.Encode(row[4]) %></td>
                    <td><%= Html.Encode(row[5]) %> VNĐ</td>
					<td><%= Html.Encode(row[6]) %> VNĐ</td>
					<td><%= Html.Encode(row[7]) %></td>
					<td><%= Html.Encode(row[10]) %></td>
					<td><a href ="<%= Html.Encode(row[8]) %>">Chi Tiết</a></td>					
                </tr>   
                <%}%>
                <tr>
                <td colspan="4" class="cart_total"><span class="red">Tổng Cộng:</span></td>
                <td colspan="3"> <%= Html.Encode(total) %> VNĐ</td>                
                </tr>                  
            <%  }
    else
    { %>
    <br />&nbsp;&nbsp;&nbsp;&nbsp;Bạn chưa có đơn đặt hàng nào !
    <%} %>   
            </table>
			
            </div>	

        <div class="clear"></div>
</asp:Content>

<asp:Content ID="indexContentRight" ContentPlaceHolderID="right_content" runat="server">
   <% Html.RenderAction("index","sidebar"); %>
</asp:Content>
